Skip to main content
Version: 2.x.x

FetchType


import { FetchType } from "@hyper-fetch/core"

Description

Defined in command/command.types.ts:244

Preview

type FetchType<Command> = FetchQueryParamsType<ExtractQueryParams<Command>, ExtractHasQueryParams<Command>> & FetchParamsType<ExtractEndpoint<Command>, ExtractHasParams<Command>> & FetchRequestDataType<ExtractRequestData<Command>, ExtractHasData<Command>> & Omit<FetchOptionsType<ExtractClientOptions<Command>>, params | data> & FetchSendActionsType<Command> & CommandQueueOptions;

Structure

{
...params1: HasQuery extends true ? {
queryParams: NegativeTypes;
} : {
queryParams: QueryParamsType | string;
};
...params2: ExtractRouteParams<EndpointType> extends NegativeTypes ? {
params: NegativeTypes;
} : (true extends HasParams ? {
params: NegativeTypes;
} : {
params: NonNullable<ExtractRouteParams<EndpointType>>;
});
...params3: RequestDataType extends NegativeTypes ? {
data: NegativeTypes;
} : (HasData extends true ? {
data: NegativeTypes;
} : {
data: NonNullable<RequestDataType>;
});
...params4: Partial<CommandConfig<string, ClientOptions>>;
onDownloadProgress: (values: FetchProgressType, details: CommandEventDetails<Command>) => void;
onRemove: (details: CommandEventDetails<Command>) => void;
onRequestStart: (details: CommandEventDetails<Command>) => void;
onResponse: (response: ClientResponseType<ExtractResponse<Command>, ExtractError<Command>>, details: CommandResponseDetails) => void;
onResponseStart: (details: CommandEventDetails<Command>) => void;
onSettle: (requestId: string, command: Command) => void;
onUploadProgress: (values: FetchProgressType, details: CommandEventDetails<Command>) => void;
dispatcherType: auto | fetch | submit;
}